﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 重写ToString方法
{
    class Program
    {
        static void Main(string[] args)
        {
            Animal animal = new Animal();
            animal.Name = "huahua";
            animal.ID = 1001;
            animal.Sex = true;

            Console.WriteLine(animal);
        }
    }

    class Animal// : Object
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public bool Sex { get; set; }
        public override string ToString()
        {
            return "ID = " + ID + ", Name = " + Name + ", Sex = " + Sex;
        }
    }
}
